1 using UnityEngine;
2 using
System.Collections;
3
4 public
class ToHubButton : MonoBehaviour
5 {
6     
public Texture2D ButtonTexture;
7     
private Rect ButtonRect;
8
9     
// Use this for initialization
10     
void Start ()
11     {
12         
if (ButtonTexture == null)
13         {
14             
this.gameObject.SetActive(false);
15             
return;
16         }
17         DontDestroyOnLoad(
this.gameObject);
18
19     }
20
21     
public void OnGUI()
22     {
23         
if (Application.loadedLevel != 0)
24         {
25             
int w = ButtonTexture.width + 4;
26             
int h = ButtonTexture.height + 4;
27
28             ButtonRect =
new Rect(Screen.width - w, Screen.height - h, w, h);
29             
if (GUI.Button(ButtonRect, ButtonTexture, GUIStyle.none))
30             {
31                 PhotonNetwork.Disconnect();
32                 Application.LoadLevel(
0);
33             }
34         }
35     }
36 }


Use this for initialization




Trò chơi Tic-Tac-Toe, game đánh caro full source code 53.587 lượt xem

Gõ tìm kiếm nhanh...